package com.yunbao.hujin.myguidepage.guide;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

import com.yunbao.hujin.myguidepage.BaseActivity;
import com.yunbao.hujin.myguidepage.MainActivity;
import com.yunbao.hujin.myguidepage.R;

import java.util.Timer;
import java.util.TimerTask;

public class LoadingActivity extends BaseActivity {

    private Context context;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//        requestWindowFeature(Window.FEATURE_ACTION_BAR);        //隐藏标题栏-FEATURE_NO_TITLE
//        int flag = WindowManager.LayoutParams.FLAG_FULLSCREEN;   //定义全屏参数
//        Window window = this.getWindow();                       //获得当前窗体对象
//        window.setFlags(flag, flag);                             //设置当前窗体为全屏显示

        setContentView(R.layout.activity_loading);

        context = this;
        jumpToMain();
    }

    /**
     * 界面跳转
     */
    private void jumpToMain() {
        //此处isFirst也可以根据版本来控制
        new Timer().schedule(new TimerTask() {
            @Override
            public void run() {
                Intent intent = new Intent(LoadingActivity.this, isFirst() ? GuideActivity.class : MainActivity.class);
                startActivity(intent);
                overridePendingTransition(R.anim.slide_right_in, R.anim.slide_left_out);//向左滑动出去
                finish();
            }
        }, 3000);
    }


}
